package com.zrwl.poscloud.commons.utils.tool;

import java.io.File;

public class DiskTool {

    public static int[] DiskSpace() {
        File file = new File("c:");
        long totalSpace = file.getTotalSpace();
        long freeSpace = file.getFreeSpace();
        long usedSpace = totalSpace - freeSpace;
//        System.out.println("总空间大小 : " + totalSpace / 1024 / 1024 / 1024 + "G");
//        System.out.println("剩余空间大小 : " + freeSpace / 1024 / 1024 / 1024 + "G");
//        System.out.println("已用空间大小 : " + usedSpace / 1024 / 1024 / 1024 + "G");
        int[] diskSpace ={0,0,0};
        diskSpace[0]=(int)(totalSpace / 1024 / 1024 / 1024);
        diskSpace[1]=(int)(freeSpace / 1024 / 1024 / 1024);
        diskSpace[2]=(int)(usedSpace / 1024 / 1024 / 1024);
        return diskSpace;
    }
}
